'''
401 error
'''

from flask import Flask, render_template, render_template_string, abort

app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'hello world'

@app.route('/user/<username>')
def user(username):
    abort(401)
    print('Unauthorized, Please login first')

@app.errorhandler(401)
def page_unauthorized(error):
    return render_template_string('<h1> Unauthorized </h1> <h2>{{ error_info }}</h2>', error_info=error)
 
if __name__ == '__main__':
    app.run(port=5000, debug=True)